#include "dialog_test.h"
#include "ui_dialog_test.h"

Dialog_test::Dialog_test(test *da,QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog_test)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);
    buffer=da;


    connect(ui->btn_true,&QPushButton::clicked,[=]{done(ENM_true_BTN);});

}

Dialog_test::~Dialog_test()
{
    delete ui;
}
int Dialog_test::show(test *buffer, QWidget *parent)
{
    Dialog_test box(buffer);
    return box.exec();
}

//注水
void Dialog_test::on_pushButton_clicked(bool checked)
{
    if(checked) buffer->write_buf[10]=0x10;
         else   buffer->write_buf[10]=0x00;

    QByteArray sm; QDataStream dataStream(&sm,QIODevice::WriteOnly);
    for(int i=0;i<28;i++) dataStream << buffer->write_buf[i];
    buffer->writeData.append(sm);

}

//内筒排水
void Dialog_test::on_pushButton_2_clicked(bool checked)
{

     if(checked) buffer->write_buf[11]=0x10;
          else   buffer->write_buf[11]=0x00;

     QByteArray sm; QDataStream dataStream(&sm,QIODevice::WriteOnly);
     for(int i=0;i<28;i++) dataStream << buffer->write_buf[i];
     buffer->writeData.append(sm);
}

//外筒排水
void Dialog_test::on_pushButton_5_clicked(bool checked)
{
    if(checked) buffer->write_buf[13]=0x10;
         else   buffer->write_buf[13]=0x00;

    QByteArray sm; QDataStream dataStream(&sm,QIODevice::WriteOnly);
    for(int i=0;i<28;i++) dataStream << buffer->write_buf[i];
    buffer->writeData.append(sm);
}

//搅拌
void Dialog_test::on_pushButton_3_clicked(bool checked)
{
    if(checked) buffer->write_buf[9]=0x10;
         else   buffer->write_buf[9]=0x00;

    QByteArray sm; QDataStream dataStream(&sm,QIODevice::WriteOnly);
    for(int i=0;i<28;i++) dataStream << buffer->write_buf[i];
    buffer->writeData.append(sm);
}

//点火
void Dialog_test::on_pushButton_4_clicked(bool checked)
{
    if(checked) buffer->write_buf[8]=0x10;
         else   buffer->write_buf[8]=0x00;

    QByteArray sm; QDataStream dataStream(&sm,QIODevice::WriteOnly);
    for(int i=0;i<28;i++) dataStream << buffer->write_buf[i];
    buffer->writeData.append(sm);
}


